home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2002 November / CD 1 / APC0211D1.ISO / workshop / prog / files / ActivePerl-5.6.1.633-MSWin32.msi / _d4b9d019ebe15354d51b6a4425f30bf1 < prev    next >
Encoding:
Text File  |  2001-09-04  |  3.7 KB  |  135 lines

  1. package ExtUtils::MM_OS2;
  2.  
  3. #use Config;
  4. #use Cwd;
  5. #use File::Basename;
  6. require Exporter;
  7.  
  8. Exporter::import('ExtUtils::MakeMaker',
  9.        qw( $Verbose &neatvalue));
  10.  
  11. unshift @MM::ISA, 'ExtUtils::MM_OS2';
  12.  
  13. sub dlsyms {
  14.     my($self,%attribs) = @_;
  15.  
  16.     my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
  17.     my($vars)  = $attribs{DL_VARS} || $self->{DL_VARS} || [];
  18.     my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
  19.     my($imports)  = $attribs{IMPORTS} || $self->{IMPORTS} || {};
  20.     my(@m);
  21.     (my $boot = $self->{NAME}) =~ s/:/_/g;
  22.  
  23.     if (not $self->{SKIPHASH}{'dynamic'}) {
  24.     push(@m,"
  25. $self->{BASEEXT}.def: Makefile.PL
  26. ",
  27.      '    $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e \'use ExtUtils::Mksymlists; \\
  28.      Mksymlists("NAME" => "$(NAME)", "DLBASE" => "$(DLBASE)", ',
  29.      '"VERSION" => "$(VERSION)", "DISTNAME" => "$(DISTNAME)", ',
  30.      '"INSTALLDIRS" => "$(INSTALLDIRS)", ',
  31.      '"DL_FUNCS" => ',neatvalue($funcs),
  32.      ', "FUNCLIST" => ',neatvalue($funclist),
  33.      ', "IMPORTS" => ',neatvalue($imports),
  34.      ', "DL_VARS" => ', neatvalue($vars), ');\'
  35. ');
  36.     }
  37.     if (%{$self->{IMPORTS}}) {
  38.     # Make import files (needed for static build)
  39.     -d 'tmp_imp' or mkdir 'tmp_imp', 0777 or die "Can't mkdir tmp_imp";
  40.     open IMP, '>tmpimp.imp' or die "Can't open tmpimp.imp";
  41.     my ($name, $exp);
  42.     while (($name, $exp)= each %{$self->{IMPORTS}}) {
  43.         my ($lib, $id) = ($exp =~ /(.*)\.(.*)/) or die "Malformed IMPORT `$exp'";
  44.         print IMP "$name $lib $id ?\n";
  45.     }
  46.     close IMP or die "Can't close tmpimp.imp";
  47.     # print "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp\n";
  48.     system "emximp -o tmpimp$Config::Config{lib_ext} tmpimp.imp" 
  49.         and die "Cannot make import library: $!, \$?=$?";
  50.     unlink <tmp_imp/*>;
  51.     system "cd tmp_imp; $Config::Config{ar} x ../tmpimp$Config::Config{lib_ext}" 
  52.         and die "Cannot extract import objects: $!, \$?=$?";      
  53.     }
  54.     join('',@m);
  55. }
  56.  
  57. sub static_lib {
  58.     my($self) = @_;
  59.     my $old = $self->ExtUtils::MM_Unix::static_lib();
  60.     return $old unless %{$self->{IMPORTS}};
  61.     
  62.     my @chunks = split /\n{2,}/, $old;
  63.     shift @chunks unless length $chunks[0]; # Empty lines at the start
  64.     $chunks[0] .= <<'EOC';
  65.  
  66.     $(AR) $(AR_STATIC_ARGS) $@ tmp_imp/* && $(RANLIB) $@
  67. EOC
  68.     return join "\n\n". '', @chunks;
  69. }
  70.  
  71. sub replace_manpage_separator {
  72.     my($self,$man) = @_;
  73.     $man =~ s,/+,.,g;
  74.     $man;
  75. }
  76.  
  77. sub maybe_command {
  78.     my($self,$file) = @_;
  79.     $file =~ s,[/\\]+,/,g;
  80.     return $file if -x $file && ! -d _;
  81.     return "$file.exe" if -x "$file.exe" && ! -d _;
  82.     return "$file.cmd" if -x "$file.cmd" && ! -d _;
  83.     return;
  84. }
  85.  
  86. sub file_name_is_absolute {
  87.     my($self,$file) = @_;
  88.     $file =~ m{^([a-z]:)?[\\/]}i ;
  89. }
  90.  
  91. sub perl_archive
  92. {
  93.  return "\$(PERL_INC)/libperl\$(LIB_EXT)";
  94. }
  95.  
  96. =item perl_archive_after
  97.  
  98. This is an internal method that returns path to a library which
  99. should be put on the linker command line I<after> the external libraries
  100. to be linked to dynamic extensions.  This may be needed if the linker
  101. is one-pass, and Perl includes some overrides for C RTL functions,
  102. such as malloc().
  103.  
  104. =cut 
  105.  
  106. sub perl_archive_after
  107. {
  108.  return "\$(PERL_INC)/libperl_override\$(LIB_EXT)" unless $OS2::is_aout;
  109.  return "";
  110. }
  111.  
  112. sub export_list
  113. {
  114.  my ($self) = @_;
  115.  return "$self->{BASEEXT}.def";
  116. }
  117.  
  118. 1;
  119. __END__
  120.  
  121. =head1 NAME
  122.  
  123. ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
  124.  
  125. =head1 SYNOPSIS
  126.  
  127.  use ExtUtils::MM_OS2; # Done internally by ExtUtils::MakeMaker if needed
  128.  
  129. =head1 DESCRIPTION
  130.  
  131. See ExtUtils::MM_Unix for a documentation of the methods provided
  132. there. This package overrides the implementation of these methods, not
  133. the semantics.
  134.  
  135.